<%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
h1{color:red;}
</style>
</head>
<body>
<h1>显示成语数据库的前6条记录</h1><%
Class.forName("com.mysql.cj.jdbc.Driver");
Connection cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/db","root","12qwas");
Statement stat=cn.createStatement();
ResultSet rs=stat.executeQuery("select cy as chyu from chengyu limit 6");
while(rs.next()){
	String cy=rs.getString("chyu");
	out.println("<p>"+cy+"</p>");
}
rs.close();
stat.close();
cn.close();
%>
</body>
</html>